﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using diploma.core.data.objects;
using diploma.core;
using diploma.core.localize;

namespace diploma.editor
{
    public partial class AddThemeForm : Form, ILocalizable
    {
        long parent;
        AbstractLocalizator localizator;
        public AddThemeForm(long _parent, AbstractLocalizator _localizator)
        {
            InitializeComponent();
            localizator = _localizator;
            Localize();
            parent = _parent;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() != "")
            {
                DialogResult = DialogResult.OK;
                newTheme = new Theme(-1, textBox1.Text, parent);
                Close();
            }
            else
            {
                MessageBox.Show(localizator.GetLocolizeWord("fill_text"), localizator.GetLocolizeWord("add_theme"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private Theme newTheme;

        public Theme NewTheme
        {
            get
            {
                return newTheme;
            }
        }

        #region ILocalizable Members

        public void Localize()
        {
            Text = localizator.GetLocolizeWord(Text);
            label1.Text = localizator.GetLocolizeWord(label1.Text);
            button1.Text = localizator.GetLocolizeWord(button1.Text);
            button2.Text = localizator.GetLocolizeWord(button2.Text);

        }

        #endregion
    }
}
